using System;

namespace Core.Demo8_IrritatingGlobal
{
	public class EmailSender
	{


		public void Send(string toAddress, string subject, string messageBody)
		{
			var fromAddress = Registry.Instance.GetKey("FromAddress");	
			var smtpServer = Registry.Instance.GetKey("SMTPServer");	
			var userId = Registry.Instance.GetKey("UserId");	
			var password = Registry.Instance.GetKey("Password");

			//Send Mail here
		}
	}

	public class Registry
	{
		private static Registry _registry;
		private Registry() {}

		public static Registry Instance
		{
			get
			{
				if (_registry == null)
					_registry = new Registry();
				return _registry;
			}
		}


		public string GetKey(string key)
		{
			//Read value from Registry here
			return key;
		}
	}
}